/*
 ============================================================================
 Name		: InputDataViewContainer.cpp
 Author	  : Vanderson Rodrigues
 Version	 : 1.0
 Copyright   : Your copyright notice
 Description : CInputDataViewContainer implementation
 ============================================================================
 */

#include "InputDataViewContainer.h"

#include <eiklabel.h>  // for example label control
#include <gulcolor.h> 

void CInputDataViewContainer::ConstructL(const TRect& aRect)
{
    InitializeControlsL();
    
    CreateWindowL();
    SetRect(aRect);
    ActivateL();
}

CInputDataViewContainer::~CInputDataViewContainer()
{
    delete iLabel;
}

/**
 *  Initialize each control upon creation.
 */
void CInputDataViewContainer::InitializeControlsL()
{
    iLabel = new (ELeave) CEikLabel;
    iLabel->SetContainerWindowL( *this );
    iLabel->OverrideColorL( EColorLabelText, KRgbWhite);
    iLabel->SetTextL( _L("Controle Financeiro.") );
}

void CInputDataViewContainer::LayoutControlsL()
{
//    iLabel = new (ELeave) CEikLabel;
//    iLabel->SetContainerWindowL( *this );
//    iLabel->OverrideColorL( EColorLabelText, KRgbWhite);
//    iLabel->SetTextL( _L("Controle Financeiro.") );
}


void CInputDataViewContainer::SizeChanged()
{
    // Control resize code
    iLabel->SetExtent( TPoint( 10, 10 ), iLabel->MinimumSize() );
}

TInt CInputDataViewContainer::CountComponentControls() const
{
    return 1; // return nbr of controls inside this container
}

CCoeControl* CInputDataViewContainer::ComponentControl( TInt aIndex ) const
{
    switch( aIndex )
    {
        case 0:
            return iLabel;
        default:
            return NULL;
    }
}

void CInputDataViewContainer::Draw( const TRect& aRect ) const
{
    CWindowGc& gc = SystemGc();
    gc.SetPenStyle( CGraphicsContext::ENullPen );
    gc.SetBrushColor( KRgbBlack);
    gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
    gc.DrawRect( aRect );
}

void CInputDataViewContainer::HandleControlEventL( CCoeControl* /*aControl*/, TCoeEvent /*aEventType*/)
{
    // TODO: Add your control event handler code here
}

